<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Demo-08-计算属性</title>
    <script type="text/javascript" src="../JS/vue.js"></script>
</head>
<body>
<div id="root">
    <!-- Vue 中的 data 数据发生改变时, 模板就会重新刷新 -->
    姓：<input v-model="firstName"><br>
    名：<input v-model="secondName"><br>
    全名：{{ fullName() }}
</div>

<script text="text/javascript">
    const object = new Vue({
        el: '#root',

        data: {
            firstName: '张',
            secondName: '三',
        },

        methods: {
            fullName() {
                return this.firstName + '-' + this.secondName;
            }
        }
    })
</script>
</body>
</html>